package icegps.com.pingdj.adapter;


import android.support.annotation.Nullable;
import android.text.TextUtils;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.clj.fastble.data.BleDevice;

import java.util.List;

import icegps.com.pingdj.R;
import icegps.com.pingdj.view.Rssi;


/**
 * Created by 111 on 2017/12/28.
 */

public class ScanBleAdapter extends BaseQuickAdapter<BleDevice, BaseViewHolder> {


    public ScanBleAdapter(int layoutResId, @Nullable List<BleDevice> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, BleDevice bleDevice) {
        helper.setText(R.id.tv_name, TextUtils.isEmpty(bleDevice.getName()) ? "NULL" : bleDevice.getName())
                .setText(R.id.tv_mac, bleDevice.getMac())
                .setText(R.id.tv_rssi, bleDevice.getRssi() + "");
        Rssi rssi = helper.getView(R.id.rssi);
        rssi.setRssi(bleDevice.getRssi());
    }
}
